#! /bin/sh

name=openssh
version=10.0p1
revision=1
tarball_url="https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${version}.tar.gz"
tarball_blake2b="4ce353adf75aade8f4b2a223ad13e2f92cd23d1e60b4ee52bad0eaf036571229438cd9760dfa99c0e10fa09a8ac47b2bfb04eb183fb7b9287ac564ec75316a75"
hostdeps="gcc pkg-config"
deps="core-libs zlib openssl"

prepare() {
    autotools_recursive_regen
}

configure() {
        ossh_cv_utmpx_h_has_ut_addr=no \
    autotools_configure \
        --sysconfdir=/etc/ssh \
        --disable-strip \
        --with-ssl-engine \
        --with-privsep-user=nobody \
        --with-privsep-path=${prefix}/share/empty.sshd \
        --with-default-path=${prefix}/local/sbin:${prefix}/local/bin:${prefix}/bin \
        --without-zlib-version-check \
        --with-xauth=/usr/bin/xauth \
        --with-pid-dir=/run
}

build() {
    make -j${parallelism}
}

package() {
    install -v -m700 -d "${dest_dir}${prefix}"/share/empty.sshd
    install -v -d "${dest_dir}"/run

    DESTDIR="${dest_dir}" make install

    post_package_strip
}
